﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data.Odbc;
using System.Data;
using Atom.Interface.DataAccess;
using Atom.Entity;

namespace Atom.DAL.Medicare
{
    public class N04DAL : BaseDAL
    {
        #region  成员方法

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public SqlExecuteResult Add(Atom.Entity.Medicare.N04Entity model, DbTransaction trans)
        {


            StringBuilder strSql = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();
            #region 拼sql语句
            if (model.USERNAME != null)
            {
                strSql1.Append("USERNAME,");
                strSql2.Append("'" + model.USERNAME + "',");
            }
            if (model.YLFKFS != null)
            {
                strSql1.Append("YLFKFS,");
                strSql2.Append("'" + model.YLFKFS + "',");
            }
            if (model.ZYCS != null)
            {
                strSql1.Append("ZYCS,");
                strSql2.Append("'" + model.ZYCS + "',");
            }
            if (model.BAH != null)
            {
                strSql1.Append("BAH,");
                strSql2.Append("'" + model.BAH + "',");
            }
            if (model.XB != null)
            {
                strSql1.Append("XB,");
                strSql2.Append("'" + model.XB + "',");
            }
            if (model.LL != null)
            {
                strSql1.Append("LL,");
                strSql2.Append("" + model.LL + ",");
            }
            if (model.HYZK != null)
            {
                strSql1.Append("HYZK,");
                strSql2.Append("'" + model.HYZK + "',");
            }
            if (model.ZYDM != null)
            {
                strSql1.Append("ZYDM,");
                strSql2.Append("'" + model.ZYDM + "',");
            }
            if (model.RYRQ != null)
            {
                strSql1.Append("RYRQ,");
                strSql2.Append("'" + model.RYRQ + "',");
            }
            if (model.RYKBDM != null)
            {
                strSql1.Append("RYKBDM,");
                strSql2.Append("'" + model.RYKBDM + "',");
            }
            if (model.CYRQ != null)
            {
                strSql1.Append("CYRQ,");
                strSql2.Append("'" + model.CYRQ + "',");
            }
            if (model.CYKBDM != null)
            {
                strSql1.Append("CYKBDM,");
                strSql2.Append("'" + model.CYKBDM + "',");
            }
            if (model.RYSQK != null)
            {
                strSql1.Append("RYSQK,");
                strSql2.Append("'" + model.RYSQK + "',");
            }
            if (model.RYZD != null)
            {
                strSql1.Append("RYZD,");
                strSql2.Append("'" + model.RYZD + "',");
            }
            if (model.RYHQZRQ != null)
            {
                strSql1.Append("RYHQZRQ,");
                strSql2.Append("'" + model.RYHQZRQ + "',");
            }
            if (model.CYSZYZD != null)
            {
                strSql1.Append("CYSZYZD,");
                strSql2.Append("'" + model.CYSZYZD + "',");
            }
            if (model.ZYZDZLJG != null)
            {
                strSql1.Append("ZYZDZLJG,");
                strSql2.Append("'" + model.ZYZDZLJG + "',");
            }
            if (model.CYSQTZD != null)
            {
                strSql1.Append("CYSQTZD,");
                strSql2.Append("'" + model.CYSQTZD + "',");
            }
            if (model.QTZDZLJG != null)
            {
                strSql1.Append("QTZDZLJG,");
                strSql2.Append("'" + model.QTZDZLJG + "',");
            }
            if (model.YYGRMC != null)
            {
                strSql1.Append("YYGRMC,");
                strSql2.Append("'" + model.YYGRMC + "',");
            }
            if (model.YYGRMCZLJG != null)
            {
                strSql1.Append("YYGRMCZLJG,");
                strSql2.Append("'" + model.YYGRMCZLJG + "',");
            }
            if (model.SSHZDWBYY != null)
            {
                strSql1.Append("SSHZDWBYY,");
                strSql2.Append("'" + model.SSHZDWBYY + "',");
            }
            if (model.SSBM != null)
            {
                strSql1.Append("SSBM,");
                strSql2.Append("'" + model.SSBM + "',");
            }
            if (model.ZYFYZJ != null)
            {
                strSql1.Append("ZYFYZJ,");
                strSql2.Append("" + model.ZYFYZJ + ",");
            }
            if (model.CW != null)
            {
                strSql1.Append("CW,");
                strSql2.Append("" + model.CW + ",");
            }
            if (model.ZC != null)
            {
                strSql1.Append("ZC,");
                strSql2.Append("" + model.ZC + ",");
            }
            if (model.XY != null)
            {
                strSql1.Append("XY,");
                strSql2.Append("" + model.XY + ",");
            }
            if (model.ZY != null)
            {
                strSql1.Append("ZY,");
                strSql2.Append("" + model.ZY + ",");
            }
            if (model.HY != null)
            {
                strSql1.Append("HY,");
                strSql2.Append("" + model.HY + ",");
            }
            if (model.HL != null)
            {
                strSql1.Append("HL,");
                strSql2.Append("" + model.HL + ",");
            }
            if (model.SX != null)
            {
                strSql1.Append("SX,");
                strSql2.Append("" + model.SX + ",");
            }
            if (model.MZ != null)
            {
                strSql1.Append("MZ,");
                strSql2.Append("" + model.MZ + ",");
            }
            if (model.QTFY != null)
            {
                strSql1.Append("QTFY,");
                strSql2.Append("" + model.QTFY + ",");
            }
            if (model.XX != null)
            {
                strSql1.Append("XX,");
                strSql2.Append("'" + model.XX + "',");
            }
            if (model.HXB != null)
            {
                strSql1.Append("HXB,");
                strSql2.Append("'" + model.HXB + "',");
            }
            if (model.XXB != null)
            {
                strSql1.Append("XXB,");
                strSql2.Append("'" + model.XXB + "',");
            }
            if (model.XJ != null)
            {
                strSql1.Append("XJ,");
                strSql2.Append("'" + model.XJ + "',");
            }
            if (model.QX != null)
            {
                strSql1.Append("QX,");
                strSql2.Append("'" + model.QX + "',");
            }
            if (model.QT != null)
            {
                strSql1.Append("QT,");
                strSql2.Append("'" + model.QT + "',");
            }
            strSql.Append("insert into tcbasb(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");

            #endregion

            OdbcCommand cmd = new OdbcCommand();
            cmd.CommandText = strSql.ToString();
            cmd.CommandType = CommandType.Text;
            return OtherDataAccessFactory.Instance().ExecuteCommand(cmd, trans);
        }
        #endregion  成员方法
    }
}
